﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 导入画面
{
    public static class GetFilePath
    {
        /// <summary>
        /// 获取文件夹下所有文件的路径
        /// </summary>
        /// <param name="dir">文件夹路径</param>
        /// <returns></returns>
        public static List<string> Director(string dir)
        {
            List<string> strings = new List<string>();
            DirectoryInfo d = new DirectoryInfo(dir);
            FileSystemInfo[] fsinfos = d.GetFileSystemInfos();
            foreach (FileSystemInfo fsinfo in fsinfos)
            {
                if (fsinfo is DirectoryInfo)     //判断是否为文件夹
                {
                    Director(fsinfo.FullName);//递归调用
                }
                else
                {
                    strings.Add(fsinfo.FullName);
                }
            }
            return strings;
        }
    }
}
